import { fileURLToPath, URL } from 'node:url'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import tailwindcss from '@tailwindcss/vite'
// https://vite.dev/config/
export default defineConfig({
  plugins: [vue(), tailwindcss()],
  server: {
    open: true,
    cors: true,
    proxy: {
      '/media': {
        target: 'http://47.109.57.7:16880/directlink/local',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/media/, ''),
      },
    },
  },
  resolve: {
    alias: {
      '@': fileURLToPath(new URL('./src', import.meta.url)),
      '@vivid-ui': fileURLToPath(new URL('./src/vivid-ui', import.meta.url)),
    },
  },
})
